Skip to content

App Config to TypeSpec#47178

Open
mrm9084 wants to merge 2 commits into
Azure:mainfrom
mrm9084:AppConfigToTypeSpec
Open

App Config to TypeSpec#47178
mrm9084 wants to merge 2 commits into
Azure:mainfrom
mrm9084:AppConfigToTypeSpec

Conversation

@mrm9084
Copy link
Copy Markdown
Member

@mrm9084 mrm9084 commented May 27, 2026

Description

Updates the Python sdk to actually use the typespec generation

All SDK Contribution checklist:

  • The pull request does not introduce [breaking changes]
  • CHANGELOG is updated for new features, bug fixes or other significant changes.
  • I have read the contribution guidelines.

General Guidelines and Best Practices

  • Title of the pull request is clear and informative.
  • There are a small number of commits, each of which have an informative message. This means that previously merged commits do not appear in the history of the PR. For more information on cleaning up the commits in your PR, see this page.

Testing Guidelines

  • Pull request includes test coverage for the included changes.

Copilot AI review requested due to automatic review settings May 27, 2026 21:28
@github-actions github-actions Bot added the App Configuration Azure.ApplicationModel.Configuration label May 27, 2026
Copy link
Copy Markdown
Contributor

Copilot AI left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Pull request overview

This PR migrates azure-appconfiguration to use TypeSpec-based (DPG) generated code, updating the generated client/models/operations (sync + async) and introducing new generation/metadata artifacts.

Changes:

  • Updates the TypeSpec source pin (tsp-location.yaml) and refreshes generated _generated/ code (operations, models, utilities, sync/async clients).
  • Introduces a packaging definition via pyproject.toml and adds new metadata files (_metadata.json, apiview-properties.json), plus an updated assets tag.
  • Applies minor formatting-only updates across samples/tests (extra blank lines, pylint suppressions).

Reviewed changes

Copilot reviewed 57 out of 58 changed files in this pull request and generated 5 comments.

Show a summary per file
File Description
sdk/appconfiguration/azure-appconfiguration/tsp-location.yaml Updates the swagger/spec commit pin used for generation.
sdk/appconfiguration/azure-appconfiguration/tests/test_azure_appconfiguration_client.py Adds pylint suppression for large test module.
sdk/appconfiguration/azure-appconfiguration/tests/test_azure_appconfiguration_client_async.py Adds pylint suppression for large async test module.
sdk/appconfiguration/azure-appconfiguration/tests/consts.py Adds pylint suppressions.
sdk/appconfiguration/azure-appconfiguration/setup.py Minor formatting cleanup (blank line removal).
sdk/appconfiguration/azure-appconfiguration/samples/sync_token_sample.py Formatting-only newline adjustment.
sdk/appconfiguration/azure-appconfiguration/samples/sync_token_sample_async.py Formatting-only newline adjustment.
sdk/appconfiguration/azure-appconfiguration/samples/snapshot_sample.py Formatting-only newline adjustment.
sdk/appconfiguration/azure-appconfiguration/samples/snapshot_sample_async.py Formatting-only newline adjustment.
sdk/appconfiguration/azure-appconfiguration/samples/send_request_sample.py Formatting-only newline adjustment.
sdk/appconfiguration/azure-appconfiguration/samples/send_request_sample_async.py Formatting-only newline adjustment.
sdk/appconfiguration/azure-appconfiguration/samples/read_only_sample.py Formatting-only newline adjustment.
sdk/appconfiguration/azure-appconfiguration/samples/read_only_sample_async.py Formatting-only newline adjustment.
sdk/appconfiguration/azure-appconfiguration/samples/list_revision_sample.py Formatting-only newline adjustment.
sdk/appconfiguration/azure-appconfiguration/samples/list_revision_sample_async.py Formatting-only newline adjustment.
sdk/appconfiguration/azure-appconfiguration/samples/list_labels_sample.py Formatting-only newline adjustment.
sdk/appconfiguration/azure-appconfiguration/samples/list_labels_sample_async.py Formatting-only newline adjustment.
sdk/appconfiguration/azure-appconfiguration/samples/list_configuration_settings_sample.py Formatting-only newline adjustment.
sdk/appconfiguration/azure-appconfiguration/samples/list_configuration_settings_sample_async.py Formatting-only newline adjustment.
sdk/appconfiguration/azure-appconfiguration/samples/hello_world_sample.py Formatting-only newline adjustment.
sdk/appconfiguration/azure-appconfiguration/samples/hello_world_sample_entra_id_and_bleu.py Whitespace cleanup in docstring + newline.
sdk/appconfiguration/azure-appconfiguration/samples/hello_world_sample_async.py Formatting-only newline adjustment.
sdk/appconfiguration/azure-appconfiguration/samples/hello_world_entra_id_sample.py Formatting-only newline adjustment.
sdk/appconfiguration/azure-appconfiguration/samples/conditional_operation_sample.py Formatting-only newline adjustment.
sdk/appconfiguration/azure-appconfiguration/samples/conditional_operation_sample_async.py Formatting-only newline adjustment.
sdk/appconfiguration/azure-appconfiguration/samples/check_configuration_settings_sample.py Formatting-only newline adjustment.
sdk/appconfiguration/azure-appconfiguration/pyproject.toml Adds/expands PEP 517/518 packaging config and project metadata.
sdk/appconfiguration/azure-appconfiguration/MANIFEST.in Minor formatting/line-number normalization in diff (no behavior change).
sdk/appconfiguration/azure-appconfiguration/azure/appconfiguration/_version.py Updates header to generated-style block; version unchanged.
sdk/appconfiguration/azure-appconfiguration/azure/appconfiguration/_generated/py.typed Removes redundant py.typed marker under _generated/.
sdk/appconfiguration/azure-appconfiguration/azure/appconfiguration/_generated/models/_patch.py Adds minor formatting; retains customization hook.
sdk/appconfiguration/azure-appconfiguration/azure/appconfiguration/_generated/models/_models.py Updates generated models to use new model base/utilities + typing/visibility metadata.
sdk/appconfiguration/azure-appconfiguration/azure/appconfiguration/_generated/models/_enums.py Minor docstring punctuation tweaks in enums.
sdk/appconfiguration/azure-appconfiguration/azure/appconfiguration/_generated/aio/_vendor.py Removes vendor mixin/helpers (moved to shared utils).
sdk/appconfiguration/azure-appconfiguration/azure/appconfiguration/_generated/aio/_patch.py Adds patching hook to copy customized members onto raw mixin.
sdk/appconfiguration/azure-appconfiguration/azure/appconfiguration/_generated/aio/_operations/_patch.py Updates customization layer to target the new raw operations mixin name.
sdk/appconfiguration/azure-appconfiguration/azure/appconfiguration/_generated/aio/_operations/_operations.py Refreshes async operations: paging, deserialization, api-version validation, stream/decompress handling.
sdk/appconfiguration/azure-appconfiguration/azure/appconfiguration/_generated/aio/_operations/init.py Adjusts exports to match new raw mixin/patch approach.
sdk/appconfiguration/azure-appconfiguration/azure/appconfiguration/_generated/aio/_configuration.py Updates async configuration defaults/docs and version import path.
sdk/appconfiguration/azure-appconfiguration/azure/appconfiguration/_generated/aio/_client.py Updates async client wiring and conditional Self import.
sdk/appconfiguration/azure-appconfiguration/azure/appconfiguration/_generated/_version.py Adds generated version module under _generated/.
sdk/appconfiguration/azure-appconfiguration/azure/appconfiguration/_generated/_validation.py Adds API version validation decorator used by operations.
sdk/appconfiguration/azure-appconfiguration/azure/appconfiguration/_generated/_utils/utils.py Introduces shared client mixin + etag helpers used by operations.
sdk/appconfiguration/azure-appconfiguration/azure/appconfiguration/_generated/_utils/serialization.py Updates generated serialization helpers (typing, safety, perf tweaks).
sdk/appconfiguration/azure-appconfiguration/azure/appconfiguration/_generated/_utils/model_base.py Updates generated model base/deserialization/serialization and XML helpers.
sdk/appconfiguration/azure-appconfiguration/azure/appconfiguration/_generated/_utils/init.py Adds _utils package marker.
sdk/appconfiguration/azure-appconfiguration/azure/appconfiguration/_generated/_patch.py Adds patching hook to copy customized members onto raw mixin.
sdk/appconfiguration/azure-appconfiguration/azure/appconfiguration/_generated/_operations/_patch.py Updates customization layer to target the new raw operations mixin name.
sdk/appconfiguration/azure-appconfiguration/azure/appconfiguration/_generated/_operations/_operations.py Refreshes sync operations: request building defaults, paging, deserialization, api-version validation, stream/decompress handling.
sdk/appconfiguration/azure-appconfiguration/azure/appconfiguration/_generated/_operations/init.py Adjusts exports to match new raw mixin/patch approach.
sdk/appconfiguration/azure-appconfiguration/azure/appconfiguration/_generated/_configuration.py Updates sync configuration defaults/docs and version import path.
sdk/appconfiguration/azure-appconfiguration/azure/appconfiguration/_generated/_client.py Updates sync client wiring and conditional Self import.
sdk/appconfiguration/azure-appconfiguration/azure/appconfiguration/_generated/init.py Switches generated package version import to _generated/_version.py.
sdk/appconfiguration/azure-appconfiguration/azure/appconfiguration/_azure_appconfiguration_requests.py Adds pylint suppressions.
sdk/appconfiguration/azure-appconfiguration/azure/init.py Adds type-ignore on pkgutil namespace extension.
sdk/appconfiguration/azure-appconfiguration/assets.json Updates the asset tag reference.
sdk/appconfiguration/azure-appconfiguration/apiview-properties.json Adds APIView cross-language mapping metadata.
sdk/appconfiguration/azure-appconfiguration/_metadata.json Adds API version metadata for generation.
Comments suppressed due to low confidence (2)

sdk/appconfiguration/azure-appconfiguration/azure/appconfiguration/_generated/aio/_operations/_patch.py:32

  • This aio patch module still imports ..._model_base and ..._serialization, but those modules no longer exist under _generated/ after the TypeSpec layout changes (the code now lives under _generated/_utils/). Importing _generated.aio._operations._patch will raise ModuleNotFoundError, which also breaks _patch_sdk() execution during package import. Update these imports (and corresponding usage) to reference _generated._utils.model_base / _generated._utils.serialization (or reintroduce the modules if they’re still required).
from ._operations import (
    _AzureAppConfigurationClientOperationsMixin as AzureAppConfigClientOpGenerated,
    ClsType,
    build_azure_app_configuration_get_key_values_request,
    build_azure_app_configuration_check_key_values_request,
)

sdk/appconfiguration/azure-appconfiguration/azure/appconfiguration/_generated/models/_patch.py:15

  • _generated/models/_patch.py imports .._model_base / .._model_base.rest_field, but _generated/_model_base.py no longer exists in this PR (model helpers were moved under _generated/_utils/). Because models/__init__.py unconditionally imports _patch and runs _patch_sdk(), this will raise ModuleNotFoundError at import time. Update the patch to use _generated._utils.model_base.Model and rest_field (or re-add the removed modules).
import datetime
from typing import Any, Dict, List, Mapping, Optional, overload

from .. import _model_base
from .._model_base import rest_field

Comment on lines +12 to +29
[project]
name = "azure-appconfiguration"
authors = [
{ name = "Microsoft Corporation", email = "azpysdkhelp@microsoft.com" },
]
description = "Microsoft Corporation Azure App Configuration Data Client Library for Python"
license = "MIT"
classifiers = [
"Development Status :: 4 - Beta",
"Programming Language :: Python",
"Programming Language :: Python :: 3 :: Only",
"Programming Language :: Python :: 3",
"Programming Language :: Python :: 3.10",
"Programming Language :: Python :: 3.11",
"Programming Language :: Python :: 3.12",
"Programming Language :: Python :: 3.13",
]
requires-python = ">=3.10"
Comment on lines +32 to 40
:keyword api_version: The API version to use for this operation. Known values are "2024-09-01"
and None. Default value is None. If not set, the operation's default API version will be used.
Note that overriding this default value may result in unsupported behavior.
:paramtype api_version: str
"""

def __init__(self, endpoint: str, credential: Union[AzureKeyCredential, "TokenCredential"], **kwargs: Any) -> None:
api_version: str = kwargs.pop("api_version", "2023-11-01")
api_version: str = kwargs.pop("api_version", "2024-09-01")

Comment on lines +32 to +41
:keyword api_version: The API version to use for this operation. Known values are "2024-09-01"
and None. Default value is None. If not set, the operation's default API version will be used.
Note that overriding this default value may result in unsupported behavior.
:paramtype api_version: str
"""

def __init__(
self, endpoint: str, credential: Union[AzureKeyCredential, "AsyncTokenCredential"], **kwargs: Any
) -> None:
api_version: str = kwargs.pop("api_version", "2023-11-01")
api_version: str = kwargs.pop("api_version", "2024-09-01")
Comment on lines +30 to +62
def decorator(func):
@functools.wraps(func)
def wrapper(*args, **kwargs):
try:
# this assumes the client has an _api_version attribute
client = args[0]
client_api_version = client._config.api_version # pylint: disable=protected-access
except AttributeError:
return func(*args, **kwargs)

if _index_with_default(method_added_on) > _index_with_default(client_api_version):
raise ValueError(
f"'{func.__name__}' is not available in API version "
f"{client_api_version}. Pass service API version {method_added_on} or newer to your client."
)

unsupported = {
parameter: api_version
for api_version, parameters in params_added_on.items()
for parameter in parameters
if parameter in kwargs and _index_with_default(api_version) > _index_with_default(client_api_version)
}
if unsupported:
raise ValueError(
"".join(
[
f"'{param}' is not available in API version {client_api_version}. "
f"Use service API version {version} or newer.\n"
for param, version in unsupported.items()
]
)
)
return func(*args, **kwargs)
Comment on lines 29 to 33
from ._operations import (
AzureAppConfigurationClientOperationsMixin as AzureAppConfigClientOpGenerated,
_AzureAppConfigurationClientOperationsMixin as AzureAppConfigClientOpGenerated,
ClsType,
build_azure_app_configuration_get_key_values_request,
build_azure_app_configuration_check_key_values_request,
@@ -11,7 +11,6 @@
import re
Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

with pyproject.toml now being generated, setup.py can be deleted we do not need both

import datetime
from typing import Any, Dict, List, Mapping, Optional, overload

from .. import _model_base
Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

E ImportError: cannot import name '_model_base' from partially initialized module 'azure.appconfiguration._generated' (most likely due to a circular import) (/Users/runner/work/1/s/.venv/azure-appconfiguration/.venv_mindependency/lib/python3.11/site-packages/azure/appconfiguration/_generated/init.py).

I would run pytest tests locally to check that all the recorded tests are working it looks like there is a import error in the previous patch code someone did with the new generated code.

Copy link
Copy Markdown
Member

@l0lawrence l0lawrence May 28, 2026

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

hmm Im unsure why this model was being patched here in the first place, I think you can remove this model from the _patch.py and the imports above, and set it back to the default empty _patch.py file (see the other generated ones as an example) since I see a KeyValue model generated under models.py and they look the exact same to me. I think that will fix your CI as well

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

App Configuration Azure.ApplicationModel.Configuration

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants